{%TEMPLATE->struct/head%}
{%TEMPLATE->struct/menu%}

{{IF ![[login.isLoggedin()]]}}
  <h2>Login</h2>
  {%TEMPLATE->struct/messages%}
  <div class="alert {{IF [[toggledarkmode]] > 0}}alert-dark" style="background-color: #32383e;{{ELSE}}alert-neutral{{ENDIF}}">
      <div class="row">
          <div class='col-md-3'></div>
          <div class='col-md-6'>
              <br>
              <form action='login.php' method='post' class="form-horizontal">
                  <input type='hidden' name='fw' value='[[fw]]'>
                  <div class="form-group">
                      <label for="inputUsername" class="col-sm-4 control-label">Username</label>
                      <div class="col-sm-12">
                          <input name='username' type="text" class="form-control" id="inputUsername" placeholder="Username" autofocus>
                      </div>
                  </div>
                  <div class="form-group">
                      <label for="inputPassword" class="col-sm-4 control-label">Password</label>
                      <div class="col-sm-12">
                          <input name='password' type="password" class="form-control" id="inputPassword" placeholder="Password">
                      </div>
                  </div>
                  {{IF [[Util::isYubikeyEnabled()]]}}
                      <div class="form-group">
                          <label for="inputOTP" class="col-sm-4 control-label">Yubikey OTP (if enabled)</label>
                          <div class="col-sm-12">
                              <input name='otp' type="password" class="form-control" id="inputOTP" placeholder="OTP">
                          </div>
                      </div>
                  {{ENDIF}}
                  <div class="form-group">
                      <div class="col-sm-offset-4 col-sm-8">
                          <button type="submit" class="btn btn-success">Sign in</button>
                          &nbsp;&nbsp;&nbsp;
                          <a href='forgot.php'>Forgot password</a>
                      </div>
                  </div>
              </form>
          </div>
          <div class='col-md-3'></div>
      </div>
  </div>
  <div class='alert alert-info'>
    This is a private closed system. If you need access you need to contact an admin of this page and
    ask for creating an account.
  </div>
{{ELSE}}
  {%TEMPLATE->struct/messages%}
  <div class='alert alert-success'>Hi [[user.getUsername()]], welcome back!</div>
  <div class="alert {{IF [[toggledarkmode]] > 0}}alert-primary{{ELSE}}alert-neutral{{ENDIF}}">
    [[$APP_NAME]] Sourcecode is available in these Github repositories:&nbsp;&nbsp;<a href="https://github.com/hashtopolis/server" target="_blank" rel="noopener"><button class="btn btn-primary">Server</button></a>&nbsp;&nbsp;
    <a href="https://github.com/hashtopolis/agent" target="_blank" rel="noopener"><button class="btn btn-primary">Client(s)</button></a><br><br>
    To get more information about how to use [[$APP_NAME]], please visit the <a href="https://github.com/hashtopolis/server/wiki" target="_blank" rel="noopener">wiki</a> or the <a href="https://hashtopolis.org" target="_blank" rel="noopener">Forum</a>.
  </div>
{{ENDIF}}
{%TEMPLATE->struct/foot%}
